package com.leyou.user.client;

import com.leyou.user.dto.AddressDTO;
import com.leyou.user.dto.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 *
 * @author: wangzibeng
 * Date: 2019/5/14 0014
 * Time: 21:39
 */
@FeignClient("user-server")
public interface UserClient {
    /**
     * 根据username password查询用户
     *
     * @param username 用户名
     * @param password 密码
     * @return UserDto
     */
    @GetMapping("query")
    UserDTO queryUserByUserNameAndPassword(@RequestParam("username") String username, @RequestParam("password") String password);

    /**
     * 查询用户的地址
     *
     * @param uid 登录用户id
     * @return 多个地址
     */
    @GetMapping("address")
    List<AddressDTO> queryAddresses(@RequestParam("uid") Long uid);

    /**
     * 根据用户UID 和地址id 查询收货地址
     *
     * @param uid 用户Id
     * @param id  地址 id
     * @return 收货地址
     */
    @GetMapping("address/buy")
    AddressDTO queryAddressByUidAndId(@RequestParam("uid") Long uid, @RequestParam("id") Long id);
}
